<template>
  <Teleport to="body">
    <div :class="['overlay', containerClass]" @click.self="emit('close')">
      <slot></slot>
    </div>
  </Teleport>
</template>

<script setup lang="ts">
defineProps<{
  containerClass?: string;
}>();
const emit = defineEmits<{
  close: [];
}>();
</script>

<style scoped lang="scss">
.overlay {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 12;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: rgba(0, 0, 0, 0.5);
}
</style>
